Fix WASM cfg proxy: remove test arm from wasm32 guards#116
Conversation
|
@cscheid I'm gonna want something like wasm-qmd-parser again in the future for the Quarto extension, but putting that off for now. |
|
Let's leave it then - I was just trying to cleanup while understanding things around and fixing the problem I found. |
|
Done — I've kept the crate skeleton (Cargo.toml, src/, tests/, licenses) and cleaned up the stale parts (old CI configs, C shim superseded by Edit: I’ll probably split work on this. No need to cleanup if you plan to rework on it. But this is definitely stale. |
The cfg pattern #[cfg(any(target_arch = "wasm32", test))] forced native tests through the WASM-restricted Lua stdlib (no io/os, synthetic modules only). This caused 8 Windows test failures because the restricted stdlib doesn't work without a real wasm32 target. Change to #[cfg(target_arch = "wasm32")] so native tests use Lua::new() with the full C stdlib on all platforms. WASM-specific code paths will be tested by dedicated WASM smoke tests on the real wasm32 target in CI.
The test_dofile_script_dir_stack test validates WASM-specific dofile behavior (script directory tracking via the VFS dofile override). The native C dofile does not track the script directory stack, so this test only passes on wasm32. Mark it ignored on native targets. See #112 for the behavioral difference discussion.
- Add .claude/rules/wasm.md: prevent cfg test proxy regression - Update xtask.md: wasm-pack → wasm-bindgen-cli, add version pinning - Update testing.md: native tests use Lua::new(), remove stale cfg proxy docs - Rewrite dev-docs/wasm.md: replace stale wasm-qmd-parser content with current wasm-quarto-hub-client architecture
6009f60 to
2db6f1e
Compare
|
Split this PR — the wasm-qmd-parser cleanup and workflow modernization are now in #125. This PR is just the cfg guard fix (removing the |
|
Thanks @cderv! I've gone back and verified that adding |
The
#[cfg(any(target_arch = "wasm32", test))]pattern infilter.rsandshortcode.rsforced native tests through the WASM-restricted Lua stdlib.This caused Windows test failures because the restricted stdlib (no io/os/debug)
doesn't work with Lua's C implementation on native targets.
Fix
Remove the
testarm from the cfg guards so native tests useLua::new()withthe full stdlib. WASM coverage is provided by dedicated WASM tests in CI.
Also marks the
dofile_wasm::test_dofile_script_dir_stacktest as#[cfg_attr(not(target_arch = "wasm32"), ignore)]since it depends onregister_wasm_dofilewhich is only available in the WASM build.Changed files
crates/pampa/src/lua/filter.rs— cfg guard fixcrates/pampa/src/lua/shortcode.rs— cfg guard fixcrates/pampa/src/lua/dofile_wasm.rs— ignore test on native.claude/rules/wasm.md— document the prohibited cfg patternclaude-notes/instructions/testing.md— update testing docsdev-docs/wasm.md— update WASM architecture docs